package com.xmkj.bearbiz.toutiao;

import android.content.Context;
import android.content.Intent;
import android.view.View;

import com.common.Entity.ArticalEntity;
import com.common.widget.recyclerview.refresh.adapter.CommonAdapter;
import com.common.widget.recyclerview.refresh.adapter.ViewHolder;
import com.xmkj.bearbiz.R;

import java.util.List;

public class TouTiaoAdapter extends CommonAdapter<ArticalEntity.ListsBean> {
    public TouTiaoAdapter(Context context, List<ArticalEntity.ListsBean> data) {
        super(context, data);
    }

    @Override
    protected void convert(ViewHolder holder, final ArticalEntity.ListsBean item, int position) {
        holder.getParentView().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(mContext,AticleActivity.class);
                intent.putExtra(AticleActivity.INFOBEAN,item);
                mContext.startActivity(intent);
            }
        });
        holder.setImageStr(R.id.iv_img,item.pic);
        holder.setText(R.id.tv_title,item.title);
        holder.setText(R.id.tv_content,item.content);

    }

    @Override
    protected int getItemViewLayoutId(int position, ArticalEntity.ListsBean item) {
        return R.layout.item_toutiao;
    }
}
